<template>
  <div class="dashboard-container">
    <div class="dashboard-text">name: {{ name }}</div>
    <div>
      <el-button type="primary" @click="testAuth()" v-if="hasAuth('ROLE_管理员')">权限测试</el-button>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import {testAuth} from '@/api/auth'
export default {
  name: 'Dashboard',
  methods: {
    testAuth(){
      testAuth().then((response)=>{
        console.log(response)
         this.$message({
            title: '成功',
            message: '操作成功',
            type: 'success',
            duration: 2000
          })
      })
    }
  },
  computed: {
    ...mapGetters([
      'name'
    ])
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
